#include <iostream>
#include <vector>
using namespace std;

class Solution
{
public:
    int minCostClimbingStairs(vector<int> &cost)
    {
        if (cost.size() == 2)
            return min(cost[0], cost[1]);
        int cost0 = 0;
        int cost1 = 0;
        for (int i = 2; i < cost.size(); i++)
        {
            int costv = min(cost0 + cost[i - 2], cost1 + cost[i - 1]);
            cost0 = cost1;
            cost1 = costv;
        }
        return min(cost0 + cost[cost.size() - 2], cost1 + cost[cost.size() - 1]);
    }
};
int main()
{
    cout << "Code746" << endl;
    Solution s;
    vector<int> cost = {10, 15, 20};
    cout << s.minCostClimbingStairs(cost) << endl;
    return 0;
}